package org.chickymate.scrumboard.client.presenter;

import org.chickymate.scrumboard.client.model.LoginInfo;
import org.chickymate.scrumboard.client.service.BoardService;
import org.chickymate.scrumboard.client.service.BoardServiceAsync;
import org.chickymate.scrumboard.client.view.CreateBoardView;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.HasWidgets;

public class AppController implements Presenter,ValueChangeHandler {

	private final HandlerManager eventBus;
	private final LoginInfo loginInfo;
	private HasWidgets container;
	
	public AppController(HandlerManager eventBus, LoginInfo loginInfo){
		this.eventBus = eventBus;
		this.loginInfo = loginInfo;
		bind();
	}
	
	private void bind() {
		History.addValueChangeHandler(this);
		BoardServiceAsync boardService = GWT.create(BoardService.class);
		
		Presenter presenter = new CreateBoardPresenter(boardService, eventBus, new CreateBoardView(), loginInfo);
		presenter.go(container);
	}	

	@Override
	public void onValueChange(ValueChangeEvent event) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void go(HasWidgets container) {
		// TODO Auto-generated method stub
		
	}

}
